<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 视频数据
 * Class VideoData
 * @package App\Models
 */
class VideoData extends Model
{
    const STATUS_YES=1;
    const STATUS_NO=2;
    protected $table = 'video_data';
    public $timestamps = false;
    protected $connection = 'mysql1'; //指明你要使用的连接


//    public function getViewNumAttribute($value)
//    {
//
//        return $this->numToFloat($value);
//    }

    public function category(){
        return $this->belongsTo('App\Models\VideoCategory', 'cate_id', 'id');
    }

    protected function numToFloat(int $num){
        if($num > 10000){
            $zs = round($num/10000,2);
            return $zs.'万';
        }else{
            return $num;
        }
    }


}
